@extends('admin.app')

@section('breadcrumb')
    <div class="bg-light lter b-b wrapper-md">
        <ol class="breadcrumb bg-light lter m-n no-padder">
            <li><a href="{{ admin_action('HomeController@index') }}">主页</a></li>
            <li>业务管理</li>
            <li class="active">用户管理</li>
        </ol>
    </div>
@endsection

@section('content')
    <div class="panel panel-default">
        <div class="panel-heading font-bold">
            机构销售统计
        </div>
        <div class="row wrapper">
            <div class="col-sm-8">
                <form class="form-horizontal" method="get"
                      action="{{ admin_action('Business\OrganizationalManagerController@orgList') }}">
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="form-group">
                                <label class="control-label col-sm-4">机构名称:</label>
                                <div class="col-sm-8">
                                <input type="text" class="form-control" name="org_name"
                                           value="{{ $query['org_name'] }}" placeholder="机构名称">
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <div class="form-group">
                                <label class="control-label col-sm-4">存量时间点:</label>
                                <div class="col-sm-8">
                                    
                                    <input type="text" class="form-control datetimepicker" name="cl_time"
                                           value="{{ $query['cl_time'] }}" placeholder="默认当前时间">
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-11">
                                <label class="control-label col-sm-2">时间节点:</label>
                                <div class="col-sm-5">
                                    
                                    <input type="text" class="form-control datetimepicker" name="start_time"
                                           value="{{ $query['start_time'] }}" placeholder="默认当天">

                                </div>
                                <div class="col-sm-5">
                                    
                                    <input type="text" class="form-control datetimepicker" name="end_time"
                                           value="{{ $query['end_time'] }}" placeholder="默认当天">

                                </div>
                        </div>
                        <div class="col-sm-1 text-left">
            <span class="input-group-btn">
              <button class="btn btn-sm btn-default" type="submit">查询</button>
            </span>
                        </div>
                    </div>
                </form>
            </div>
            <?php $query['download'] = 'download' ?>
            <div class="col-sm-4 text-right text-center-xs"><a href="{{ admin_action('Business\OrganizationalManagerController@orgList',$query) }}" class="btn btn-sm btn-primary btn-addon">
                        <i class="fa fa-download"></i>excel导出查询结果
                    </a>
            </div>
            <?php unset($query['download']) ?>
        </div>
        <div class="table-responsive">
            <table class="table table-striped b-t b-light">
                <thead>
                <tr>
                    <th>机构简码</th>
                    <th>机构名称</th>
                    <th>机构人员数</th>
                    <th>经纪人</th>
                    <th>二级经纪人</th>
                    <th>存量</th>
                    <th>交易量</th>
                    <th>到期量</th>
                    <th>未封包交易</th>
                    <th>未还款交易</th>
                    <th>流失</th>
                    <th>续投</th>
                    <th>新增</th>
                </tr>
                </thead>
                <tbody>
                @forelse ($org_user as $user)
                    <tr>
                        <td>{{ $user->simple_code }}</td>
                        <td>{{ $user->company_name }}</td>
                        <td>{{ $user->number_of_members or 0 }}</td>
                        <td>{{ $user->number_of_brokers or 0 }}</td>
                        <td>{{ $user->number_of_two_level_brokers or 0 }}</td>
                        <td>{{ $user->total_stock or 0 }}</td>
                        <td>{{ $user->total_transactions or 0 }}</td>
                        <td>{{ $user->maturity_amount or 0 }}</td>
                        <td>{{ $user->the_current_transaction_is_not_established or 0 }}</td>
                        <td>{{ $user->non_repayment_transaction or 0 }}</td>
                        <td>{{ $user->loss_amount or 0 }}</td>
                        <td>{{ $user->continued_investment_amount or 0 }}</td>
                        <td>{{ $user->add_amount or 0 }}</td>
                        <td>
                        <?php $query['org_code'] = $user->simple_code ?>
                            <a class="btn btn-xs btn-primary"
                               href="{{ admin_action('Business\OrganizationalManagerController@deptList', $query) }}"
                               data-toggle="tooltip" title="机构下属部门">
                                <i class="fa fa-sitemap"></i>
                            </a>
                        </td>
                    </tr>
                @empty
                    <tr>
                        <td colspan="3" class="text-center">没有找到用户记录</td>
                    </tr>
                @endforelse
                </tbody>
            </table>
        </div>
        <div class="panel-footer">
            <div class="row">
                <div class="col-sm-12 text-right text-center-xs">
                    {!! $links !!}
                </div>
            </div>
        </div>
    </div>
@endsection